<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>扩展运算符应用</title>
    <link rel="stylesheet" href="./CSS/扩展运算符.css">
</head>
<body>
<div class="container">
    <div>1</div>
    <div>2</div>
    <div>3</div>
</div>
<script>
    // 1. 数组合并
    const name1 = ['张三', '李四', '王五'];
    const name2 = ['陆六','晓七'];
    // 1) ES5 之前的方法
    let name_ES5=name1.concat(name2)
    console.log(name_ES5)
    // 2) ES6 方法
    let name_ES6=[...name1,...name2]
    console.log(name_ES6)

    // 2. 数组克隆
    const name_clon=[...name1]
    console.log(name_clon);

    // 3. 将伪数组转化为真数组
    const box=document.querySelectorAll('.container>div');
    [...box].forEach((item)=>{
        item.addEventListener('click',function (){
            alert(this.innerHTML)
        })
    })
</script>
</body>
</html>